﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq.Mapping;
using MethodWorx.CMS.Membership;
using System.Data.Linq;

namespace MethodWorx.CMS.Linq
{
    [Table(Name="dbo.Role")]
    public class LinqRole : Role
    {

        private EntitySet<LinqRolePermission> proxyLinqRolePermission = new EntitySet<LinqRolePermission>();

        public LinqRole()
        {
            
        }

        [Association(Name = "Permissions", OtherKey = "RoleId", ThisKey = "Id", Storage = "proxyLinqRolePermission")]
        public EntitySet<LinqRolePermission> ProxyLinqRolePermission
        {
            get { return this.proxyLinqRolePermission; }
            set { this.proxyLinqRolePermission.Assign(value); }
        }

        public override IEnumerable<RolePermission> Permissions
        {
            get
            {
                return this.ProxyLinqRolePermission.Cast<RolePermission>();
            }
            
        }

        #region Proxy Property For Id
        [Column(IsPrimaryKey = true, UpdateCheck = UpdateCheck.Never)]
        public new Guid Id { get { return base.Id; } set { base.Id = value; } }
        #endregion
      
        
        #region Proxy Property For Name
        [Column(UpdateCheck=UpdateCheck.Never)]
        public new string Name { get { return base.Name; } set { base.Name = value; } }
        #endregion


      
    }
}
